<template>
  <div class="DecRoot">
    <el-card class="box-card">
      <div class="headerBox">
        <div class="leftBox" style="margin-bottom: 20px">供应商审核</div>
        <!-- <el-button
          type="primary"
          icon="el-icon-plus"
          @click="dialogVisible = true"
          plain
          >批量审核</el-button
        > -->
      </div>
      <div class="search">
        <el-form :inline="true">
          <el-form-item label="店铺名">
            <el-input v-model="ipageCofig.storeName"></el-input>
          </el-form-item>
          <el-form-item label="注册手机号">
            <el-input v-model="ipageCofig.phone"></el-input>
          </el-form-item>
          <el-form-item label="入驻状态">
            <el-select v-model="ipageCofig.isPass" placeholder="">
              <el-option label="全部" value=" "></el-option>
              <el-option label="审核中" value="0"></el-option>
              <el-option label="审核成功" value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="信息修改状态">
            <el-select v-model="ipageCofig.storeUpdateDisable" placeholder="">
              <el-option label="全部" value=" "></el-option>
              <el-option label="审核中" value="0"></el-option>
              <el-option label="审核成功" value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-button
            size="small"
            style="margin-top: 3px"
            type="primary"
            @click="selectPage()"
            >查询</el-button
          >
        </el-form>
      </div>
    </el-card>
    <el-card class="box-card newCard">
      <el-table
        :data="tableData"
        style="width: 100%"
        height="62vh"
        header-cell-class-name="tableHeader"
        stripe
      >
        <el-table-column label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column prop="storeName" label="店铺名称"> </el-table-column>
        <el-table-column prop="memberName" label="注册手机号">
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间"> </el-table-column>
        <el-table-column prop="value" label="入驻状态">
          <template slot-scope="scope">
            {{ scope.row.storeDisable ? "审核成功" : "审核中" }}
          </template>
        </el-table-column>
        <el-table-column prop="value" label="信息修改状态">
          <template slot-scope="scope">
            {{ !scope.row.storeUpdateDisable ? "审核成功" : "审核中" }}
          </template>
        </el-table-column>
        <el-table-column prop="address" label="操作" width="100">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              content="详情"
              placement="top"
            >
              <img
                src="@/assets/image/icon/details.png"
                @click="editChange(scope.row)"
                class="iconImg"
                alt=""
              />
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <div></div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="ipageCofig.pageSize"
          :current-page.sync="ipageCofig.pageNumber"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-card>
    <el-dialog :visible.sync="dialogVisible" width="500" class="newDialog">
      <div class="DiaLogHeader">
        <div class="titlebOX">详情</div>
        <div class="chahao" @click="dialogVisible = false">
          <i class="el-icon-close"></i>
        </div>
      </div>
      <el-divider></el-divider>
      <div style="padding: 20px 40px">
        <el-form ref="form" :model="form" label-width="auto">
          <el-form-item label="注册手机号：">
            {{ rowData.storePhone }}</el-form-item
          >
          <el-form-item label="店铺名称："
            >{{ rowData.storeName }}
          </el-form-item>
          <el-form-item label="店铺联系人：">
            {{ rowData.memberNickName }}
          </el-form-item>
          <el-form-item label="联系电话："
            >{{ rowData.storePhone }}
          </el-form-item>
          <el-form-item label="店铺地址："
            >{{ rowData.storeAddressDetail }}
          </el-form-item>
          <el-form-item label="所在市场：">
            {{ rowData.storeMarket }}</el-form-item
          >
          <el-form-item label="微信号："> {{ rowData.storeVx }}</el-form-item>
          <el-form-item label="邮箱："> {{ rowData.storeEmail }}</el-form-item>
          <el-form-item label="微信二维码：">
            <el-image
              style="width: 100px; height: 100px"
              :src="rowData.storeQrcode"
              :preview-src-list="[rowData.storeQrcode]"
            >
            </el-image>
            <!-- <img
              :src="rowData.storeQrcode"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
          </el-form-item>
          <el-form-item label="身份证正面：">
            <!-- <img
              :src="rowData.idCardFront"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="rowData.idCardFront"
              :preview-src-list="[rowData.idCardFront]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="身份证反面：">
            <!-- <img
              :src="rowData.idCardBack"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="rowData.idCardBack"
              :preview-src-list="[rowData.idCardBack]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="营业执照：">
            <!-- <img
              :src="rowData.businessLicense"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="rowData.businessLicense"
              :preview-src-list="[rowData.businessLicense]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="店铺域名：">
            <div v-if="rowData.storeDomainName">
              http：//www.{{ rowData.storeDomainName }} .wjtzw.cn
            </div>
          </el-form-item>
        </el-form>
      </div>
      <div class="btnBox">
        <el-button
          type="primary"
          @click="setStoreDisableStatus(rowData.id, 1)"
          v-if="!rowData.storeDisable || rowData.storeUpdateDisable"
        >
          审核成功</el-button
        >
        <el-button
          v-if="!rowData.storeDisable || rowData.storeUpdateDisable"
          type="danger"
          @click="setStoreDisableStatus(rowData.id, 0)"
        >
          审核失败</el-button
        >
        <el-button @click="dialogVisible = false"> 取消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisibleB" width="800" class="newDialog">
      <div class="DiaLogHeader">
        <div class="titlebOX">详情</div>
        <div class="chahao" @click="dialogVisibleB = false">
          <i class="el-icon-close"></i>
        </div>
      </div>
      <el-divider></el-divider>
      <div
        style="
          padding: 20px 40px;
          display: flex;
          justify-content: space-between;
        "
      >
        <el-form ref="form" :model="form" label-width="auto" style="width: 48%">
          <el-form-item label=" ">
            <div style="font-size: 16px; font-weight: 700">旧信息</div>
          </el-form-item>
          <el-form-item label="注册手机号：">
            <div>
              {{ oldForm.memberName }}
            </div></el-form-item
          >
          <el-form-item label="店铺名称："
            >{{ oldForm.storeName }}
          </el-form-item>
          <el-form-item label="店铺联系人：">
            {{ oldForm.memberNickName }}
          </el-form-item>
          <el-form-item label="联系电话："
            >{{ oldForm.storePhone }}
          </el-form-item>
          <el-form-item label="店铺地址："
            >{{ oldForm.storeAddressDetail }}
          </el-form-item>
          <el-form-item label="所在市场：">
            {{ oldForm.storeMarket }}</el-form-item
          >
          <el-form-item label="微信号："> {{ oldForm.storeVx }}</el-form-item>
          <el-form-item label="邮箱："> {{ oldForm.storeEmail }}</el-form-item>
          <el-form-item label="真实姓名："> {{ oldForm.realName }}</el-form-item>
          <el-form-item label="身份证号："> {{ oldForm.idNumber }}</el-form-item>
          <el-form-item label="微信二维码：">
            <el-image
              style="width: 100px; height: 100px"
              :src="oldForm.storeQrcode"
              :preview-src-list="[oldForm.storeQrcode]"
            >
            </el-image>
            <!-- <img
              :src="rowData.storeQrcode"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
          </el-form-item>
          <el-form-item label="身份证正面：">
            <!-- <img
              :src="rowData.idCardFront"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="oldForm.idCardFront"
              :preview-src-list="[oldForm.idCardFront]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="身份证反面：">
            <!-- <img
              :src="rowData.idCardBack"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="oldForm.idCardBack"
              :preview-src-list="[oldForm.idCardBack]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="营业执照：">
            <!-- <img
              :src="rowData.businessLicense"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="oldForm.businessLicense"
              :preview-src-list="[oldForm.businessLicense]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="店铺域名：">
            <div v-if="oldForm.storeDomainName">
              http：//www.{{ oldForm.storeDomainName }} .wjtzw.cn
            </div>
          </el-form-item>
        </el-form>
        <el-form ref="form" :model="form" label-width="auto" style="width: 48%">
          <el-form-item label=" ">
            <div style="font-size: 16px; font-weight: 700">新信息</div>
          </el-form-item>
          <el-form-item
            label="注册手机号："
            :class="oldForm.memberName !== newForm.memberName ? 'redText' : ''"
          >
            {{ newForm.memberName }}</el-form-item
          >
          <el-form-item
            label="店铺名称："
            :class="oldForm.storeName !== newForm.storeName ? 'redText' : ''"
            >{{ newForm.storeName }}
          </el-form-item>
          <el-form-item
            label="店铺联系人："
            :class="
              oldForm.memberNickName !== newForm.memberNickName ? 'redText' : ''
            "
          >
            {{ newForm.memberNickName }}
          </el-form-item>
          <el-form-item
            label="联系电话："
            :class="
              oldForm.storePhone !== newForm.storePhone ? 'redText' : ''
            "
            >{{ newForm.storePhone }}
          </el-form-item>
          <el-form-item label="店铺地址："
          :class="
              oldForm.storeAddressDetail !== newForm.storeAddressDetail ? 'redText' : ''
            "
            >{{ newForm.storeAddressDetail }}
          </el-form-item>
          <el-form-item label="所在市场："
          :class="
              oldForm.storeMarket !== newForm.storeMarket ? 'redText' : ''
            "
          >
            {{ newForm.storeMarket }}</el-form-item
          >
          <el-form-item label="微信号："
          :class="
              oldForm.storeVx !== newForm.storeVx ? 'redText' : ''
            "
          > {{ newForm.storeVx }}</el-form-item>
          <el-form-item label="邮箱："
          :class="
              oldForm.storeEmail !== newForm.storeEmail ? 'redText' : ''
            "
          > {{ newForm.storeEmail }}</el-form-item>
          <el-form-item label="真实姓名："
          :class="
              oldForm.realName !== newForm.realName ? 'redText' : ''
            "
          > {{ newForm.realName }}</el-form-item>
          <el-form-item label="身份证号："
          :class="
              oldForm.idNumber !== newForm.idNumber ? 'redText' : ''
            "
          > {{ newForm.idNumber }}</el-form-item>
          <el-form-item label="微信二维码："
          :class="
              oldForm.storeQrcode !== newForm.storeQrcode ? 'redText' : ''
            "
          >
            <el-image
              style="width: 100px; height: 100px"
              :src="newForm.storeQrcode"
              :preview-src-list="[newForm.storeQrcode]"
            >
            </el-image>
            <!-- <img
              :src="rowData.storeQrcode"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
          </el-form-item>
          <el-form-item label="身份证正面："
          :class="
              oldForm.idCardFront !== newForm.idCardFront ? 'redText' : ''
            "
          >
            <!-- <img
              :src="rowData.idCardFront"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="newForm.idCardFront"
              :preview-src-list="[newForm.idCardFront]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="身份证反面："
          :class="
              oldForm.idCardBack !== newForm.idCardBack ? 'redText' : ''
            "
          >
            <!-- <img
              :src="rowData.idCardBack"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="newForm.idCardBack"
              :preview-src-list="[newForm.idCardBack]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="营业执照："
          :class="
              oldForm.businessLicense !== newForm.businessLicense ? 'redText' : ''
            "
          >
            <!-- <img
              :src="rowData.businessLicense"
              style="width: 100px; height: 100px"
              alt=""
            /> -->
            <el-image
              style="width: 100px; height: 100px"
              :src="newForm.businessLicense"
              :preview-src-list="[newForm.businessLicense]"
            >
            </el-image>
          </el-form-item>
          <el-form-item label="店铺域名："
          
          :class="
              oldForm.storeDomainName !== newForm.storeDomainName ? 'redText' : ''
            ">
            <div v-if="newForm.storeDomainName">
              http：//www.{{ newForm.storeDomainName }} .wjtzw.cn
            </div>
          </el-form-item>
        </el-form>
      </div>
      <div class="btnBox">
        <el-button
          type="primary"
          @click="setStoreDisableStatus(newForm.id, 1)"
          v-if="newForm.storeUpdateDisable"
        >
          审核成功</el-button
        >
        <el-button
          v-if="newForm.storeUpdateDisable"
          type="danger"
          @click="setStoreDisableStatus(newForm.id, 0)"
        >
          审核失败</el-button
        >
        <el-button @click="dialogVisibleB = false"> 取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
  
  <script>
import ckeditor4 from "@/components/ckeditor4";
import {
  selectPage,
  selectStoreById,
  setStoreDisableStatus,
} from "@/api/MembershipManagement";
import Moment from "moment";

export default {
  components: { ckeditor4 },
  name: "helpCenter",
  data() {
    return {
      form: {},
      dialogVisibleB: false,
      dialogVisible: false,
      ipageCofig: {
        storeName: "",
        pageNumber: 1,
        pageSize: 10,
        isPass: "",
        phone: "",
        storeUpdateDisable: " ",
      },
      tableData: [],
      total: null,
      rowData: {},
      oldForm: {},
      newForm: {},
    };
  },
  created() {
    this.selectPage();
  },
  methods: {
    //供应商审核
    setStoreDisableStatus(id, type) {
      let params = {};
      if (type == 1) {
        this.$confirm("是否确认审核成功?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          params = {
            id: id,
            type: type,
          };
          setStoreDisableStatus(params).then((data) => {
            if (data.code == 200) {
              this.$message({
                type: "success",
                message: "操作成功",
              });
              this.dialogVisible = false;
              this.dialogVisibleB = false;
              this.selectPage();
            }
          });
        });
      } else {
        this.$prompt("请输入未通过原因", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          inputPattern: /^.{1,15}$/,
          inputErrorMessage: "请输入1-15字数",
        }).then(({ value }) => {
          params = {
            id: id,
            type: type,
            message: value,
          };
          setStoreDisableStatus(params).then((data) => {
            if (data.code == 200) {
              this.$message({
                type: "success",
                message: "操作成功",
              });
              this.dialogVisible = false;
              this.dialogVisibleB = false;
              this.selectPage();
            }
          });
        });
      }
    },
    editChange(row) {
      selectStoreById({
        id: row.id,
      }).then((data) => {
        if (!row.storeDisable) {
          this.rowData = data.data;
          this.dialogVisible = true;
        } else if (row.storeUpdateDisable) {
          this.oldForm = data.data.oldInfo;
          this.newForm = data.data.newInfo;
          this.dialogVisibleB = true;
        } else {
          this.rowData = data.data;
          this.dialogVisible = true;
        }
      });
    },
    //获取列表
    selectPage() {
      selectPage(this.ipageCofig).then((data) => {
        this.tableData = data.data.list;
        this.total = data.data.total;
      });
    },
    handleSizeChange(val) {
      this.ipageCofig.pageSize = val;
      this.selectPage();
    },
    handleCurrentChange(val) {
      this.ipageCofig.pageNumber = val;
      this.selectPage();
    },
  },
};
</script>
  
  <style scoped lang="scss">
.btnBox {
  display: flex;
  justify-content: center;
  background: #fff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 10px 0;

  .btnImg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
  }
}

.DecRoot {
  padding: 20px;
  padding-left: 5px;
  padding-bottom: 0;

  .newCard {
    height: 70vh;
    margin-top: 20px;
  }

  /deep/ .el-button {
    padding: 9px 15px;
  }

  .el-card {
    .headerBox {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .leftBox {
        display: flex;
        align-items: center;
        font-size: 18px;
        font-weight: 700;

        /deep/ .el-form-item {
          margin-bottom: 0;
        }

        /deep/ .el-input--suffix {
          width: 200px;
        }
      }
    }

    /deep/ .tableHeader {
      background: #edf3ff;
      font-weight: 700;
      color: #666666;
    }

    .iconImg {
      width: 20px;
      height: 20px;
      cursor: pointer;
      margin-right: 10px;
    }

    .pagination {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;

      /deep/ .el-pagination__editor.el-input .el-input__inner {
        height: 28px !important;
      }

      /deep/ .el-input--mini .el-input__inner {
        height: 28px !important;
      }
    }
  }
}
</style>
    <style scoped lang="scss">
.search {
  display: flex;
}
.newDialog {
  .redText {
    color: red;
    /deep/ .el-form-item__label {
      color: red;
    }
  }
  /deep/ .el-divider {
    margin: 0px;
  }
  /deep/ .el-dialog__header {
    padding: 0;
  }
  /deep/ .el-form-item__content {
    width: 75%;
  }
  /deep/ .el-select {
    width: 100%;
  }
  /deep/ .tableHeader {
    background: #edf3ff;
    font-weight: 700;
    color: #666666;
    padding: 5px 0;
  }
  .btnBox {
    display: flex;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 10px 0;
    .btnImg {
      width: 14px;
      height: 14px;
      vertical-align: middle;
    }
    /deep/ .el-button {
      padding: 10px 20px;
    }
  }
  .DiaLogHeader {
    display: flex;
    padding: 10px 20px;
    justify-content: space-between;
    .titlebOX {
      font-size: 16px;
      font-weight: 700;
    }
    .chahao {
      width: 20px;
      height: 20px;
      background-image: url("@/assets/image/icon/chahao.png");
      background-size: 100% 100%;
      text-align: center;
      line-height: 20px;
      color: #e65f00;
      cursor: pointer;
    }
  }
  /deep/ .el-input {
    width: 100% !important;
  }
}
/deep/ .el-dialog__header {
  font-weight: 700;
}
/deep/ .demo-ruleForm {
  padding: 10px;
}

/deep/ .el-form-item {
  margin-bottom: 8px;
}
/deep/ .el-form-item__error {
  z-index: 99;
}
/deep/ .el-dialog__body {
  padding: 0;
  padding-top: 10px;
  padding-bottom: 60px;
}
.dialogTextBox {
  font-size: 14px;
  color: #000000;
}
</style>
  